package com.wxk.lambda.exercise;

import com.wxk.lambda.data.Person;

import java.util.ArrayList;

/**
 * wxk
 */
public class Exercise1 {

    public static void main(String[] args) {

        ArrayList<Person> list = new ArrayList<>();

        list.add(new Person("xiaoming", 10));
        list.add(new Person("lilei", 11));
        list.add(new Person("hanmeimei", 12));
        list.add(new Person("lily", 9));
        list.add(new Person("lucy", 9));
        list.add(new Person("polly", 3));
        list.add(new Person("uncle wang", 40));

        //排序
        list.sort((o1, o2) -> o2.age - o1.age);

        System.out.println("年龄降序排序:" + list);


    }
}
